<?php if(!defined('BASEPATH')) exit('No direct script allowed');

class mdl_anggaran extends CI_Model{
	
	function __construct()
	{
		parent::__construct();
	}
	
	function getItem($num=0, $offset=0)
	{
				$this->db->flush_cache();		$this->db->select('distinct(id_anggaran),tanggal,uraian,namafile');		$this->db->from('anggaran_post');		$this->db->order_by('id_anggaran');		$this->db->limit($num, $offset);		return $this->db->get();
	}
	 
	function getItemById($id)
	{
		$this->db->flush_cache();
		$this->db->where('id_anggaran', $id);
		return $this->db->get('anggaran_post');
	}

	function insert($data)
	{
		$this->db->flush_cache();
		$this->db->insert('anggaran_post', $data);		//$this->db->insert('anggaran_post_backup', $data);
	}
	function insert_data($data)	{		$this->db->flush_cache();		$this->db->insert('anggaran', $data);		//$this->db->insert('anggaran_backup', $data);	}
	function update($id, $data)
	{
		$this->db->flush_cache();
		$this->db->where('id_anggaran', $id);
		$this->db->update('anggaran_post', $data);
	}
	
	function delete($id)
	{
		$this->db->flush_cache();
		$this->db->delete('anggaran_post', array('id_anggaran' => $id));
	}
	
}